import pandas as pd
import numpy as np

# 列表数据
data_list = [1, 2, 3, 4, 5]
# Numpy数组数据
data_np = np.array([1, 2, 3, 4, 5])
# 字典数据
data_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
# 列表的列表数据
data_list_of_lists = [
    ['John', 25, 'Engineer'],
    ['Alice', 30, 'Doctor'],
    ['Bob', 28, 'Lawyer']
]
# 列名
columns = ['Name', 'Age', 'Occupation']
# 字典数据
data_dict = {
    'Name': ['John', 'Alice', 'Bob'],
    'Age': [25, 30, 28],
    'Occupation': ['Engineer', 'Doctor', 'Lawyer']
}


# 从列表创建Series
s1 = pd.Series(data_list)
print(s1)
print()
# 从Numpy数组创建Series
s2 = pd.Series(data_np)
print(s2)
print()
# 从字典创建Series
s3 = pd.Series(data_dict)
print(s3)
print()
# 从列表的列表创建DataFrame
df = pd.DataFrame(data_list_of_lists, columns=columns)
print(df)
print()
# 从字典创建DataFrame
df = pd.DataFrame(data_dict)
print(df)